Package com.cisco.pt.ptmp
Interface PacketTracerConnection
- All Known Implementing Classes:
PacketTracerConnectionImpl
public interface PacketTracerConnection
Manages the socket channel and provides read/write access to the socket channel
- Author:
- packettracerexapps@external.cisco.com
-
Method Summary
Modifier and TypeMethodDescriptionbooleanconnect()Open a socket channel on the specified host:portvoidvoidClose the underlying socket channelvoidgetHost()intgetPort()booleanReturns true if the underlying socket connection is not null and is connectedbooleanisDown()booleanisOpen()booleanisUp()voidintread(ByteBuffer byteBuffer) Uses the underlying socket channel to read the byte bufferbooleanvoidintwrite(ByteBuffer byteBuffer) Uses the underlying socket channel to write the byte buffer
-
Method Details
-
getHost
String getHost()- Returns:
- host name (e.g. localhost)
-
getPort
int getPort()- Returns:
- port number (e.g. 39000)
-
connect
boolean connect()Open a socket channel on the specified host:port- Returns:
- true if connection succeeded
-
reconnect
boolean reconnect() -
connectLowLevelReadThread
void connectLowLevelReadThread() -
reconnectLowLevelReadThread
void reconnectLowLevelReadThread() -
disconnectLowLevelReadThread
void disconnectLowLevelReadThread() -
isUp
boolean isUp() -
isDown
boolean isDown() -
isOpen
boolean isOpen() -
getCurrentStatus
Object getCurrentStatus() -
getCurrentStatusReason
String getCurrentStatusReason() -
getCurrentStatusThrowable
Throwable getCurrentStatusThrowable() -
getNextMessage
- Throws:
IOExceptionInterruptedException
-
noteLowLevelReadError
-
disconnect
Close the underlying socket channel- Throws:
IOException- The exception
-
isConnected
boolean isConnected()Returns true if the underlying socket connection is not null and is connected- Returns:
- boolean if successful
-
read
Uses the underlying socket channel to read the byte buffer- Parameters:
byteBuffer- ByteBuffer- Returns:
- number of bytes read
- Throws:
IOException- The exception
-
write
Uses the underlying socket channel to write the byte buffer- Parameters:
byteBuffer- ByteBuffer- Returns:
- number of bytes written
- Throws:
IOException- The exception
-
socketChannel
SocketChannel socketChannel()- Returns:
- the underlying socket channel
-
connectionNegotiationProperties
ConnectionNegotiationProperties connectionNegotiationProperties()- Returns:
- the connection negotiation properties for this connection
-